package google.map.test;

import android.os.Bundle;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;

//public class MaptestActivity extends Activity {
//    /** Called when the activity is first created. */
//    @Override
//    public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.main);
//    }
//}

 
public class MaptestActivity extends MapActivity {  
    /** Called when the activity is first created. */  
    private MapView map;    
      private MapController controller;   
     
   @Override  
   public void onCreate(Bundle savedInstanceState) {  
       super.onCreate(savedInstanceState);  
       setContentView(R.layout.main);  
       initMapView();    
       initMyLocation();  
   }  
 
   private void initMyLocation() {  
       // TODO Auto-generated method stub  
       final MyLocationOverlay overlay = new MyLocationOverlay(this, map);  
       overlay.enableMyLocation();   
       overlay.runOnFirstFix(new Runnable() {    
            public void run() {    
               controller.setZoom(8);    
               controller.animateTo(overlay.getMyLocation());    
            }    
         });    
         map.getOverlays().add(overlay);   
   }  
 
   private void initMapView() {  
       // TODO Auto-generated method stub  
       map = (MapView) findViewById(R.id.map);    
         controller = map.getController();   
         //map.setSatellite(true);  
         //map.setTraffic(true);  
         map.setStreetView(true);  
         map.setBuiltInZoomControls(true);  
   }  
 
    @Override
   protected boolean isRouteDisplayed() {  
       // TODO Auto-generated method stub  
       return false;  
   }  
} 

